import request from '@/config/axios'

export interface ProductInfoVO {
  id: number
  name: string
  code: string
  spec: string
  groupId: number
  unitId: number
  image: string
  type: number
  category: number
  openBatchNo: number
  openSerialNo: number
  status: number
  sort: number
  remark: string
}

// 查询产品信息分页
export const getProductInfoPage = async (params) => {
  return await request.get({ url: `/base/product-info/page`, params })
}

// 查询产品信息详情
export const getProductInfo = async (id: number) => {
  return await request.get({ url: `/base/product-info/get?id=` + id })
}

// 新增产品信息
export const createProductInfo = async (data: ProductInfoVO) => {
  return await request.post({ url: `/base/product-info/create`, data })
}

// 修改产品信息
export const updateProductInfo = async (data: ProductInfoVO) => {
  return await request.put({ url: `/base/product-info/update`, data })
}

// 删除产品信息
export const deleteProductInfo = async (id: number) => {
  return await request.delete({ url: `/base/product-info/delete?id=` + id })
}

// 导出产品信息 Excel
export const exportProductInfo = async (params) => {
  return await request.download({ url: `/base/product-info/export-excel`, params })
}